﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using C.Entities;
using C.Unite;

namespace ArtLand.OA.Project
{
    public partial class test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            List<HR_VCATON> tonList = TbsDbSession.Default.From<HR_VCATON>().ToList();
            foreach (HR_VCATON item in tonList)
            {
                if (item.IsUserYear.Value)
                {
                    HR_TVCATN tvc = TbsDbSession.Default.From<HR_TVCATN>().Where(HR_TVCATN._.EMPLID == item.EMPLID && HR_TVCATN._.VTYEAR == DateTime.Now.Year).ToFirst();
                    if (tvc != null)
                    {
                        HR_TVCATN tv = new HR_TVCATN();
                        tv.ID = tvc.ID;
                        tv.Attach();
                        tv.LEFQTY = tvc.LEFQTY.Value - item.REQQTY.Value;
                        tv.COMQTY = item.REQQTY.Value;// Convert.ToDecimal(txt_REQQTY.Text);
                        TbsDbSession.Default.Update<HR_TVCATN>(tv);
                    }
                }
            }
           

            //Response.Write(DataBaseHelper.BindTree(null, EnumData.DataBaseEunm.Material));
        }
    }
}